<?php

class Database {

	#### Class Attributes ####

	private $db_name;
    private $db_user;
    private $db_host;
    private $db_pass;
    
    public $con;
    
    #### Constructor and Destructor ####
    
    public function __construct($db_host, $db_user, $db_pass, $db_name) {
		$this->db_host = $db_host;
        $this->db_user = $db_user;
        $this->db_pass = $db_pass;
    	$this->db_name = $db_name;
        
        $this->con = new mysqli($db_host, $db_user, $db_pass, $db_name);
    } 
        
    public function __destruct() {
    	$this->dbClose();
    } 


	#### Other Methods ####
    
	public function dbClose() {
    	$thread_id = $this->con->thread_id;
        $this->con->kill($thread_id);
        $this->con->close();
    }
    
} // End of Database class

?>